package com.atguigu.common.util;

/**
 * @description:
 * @author: pandeng_zhu
 * @time: 2023/2/13 19:27
 */

/**
 * 生成四位和六位的随机数字
 */
public class RandomUtils {

   /* private static final Random random = new Random();

    private static final DecimalFormat fourdf = new DecimalFormat("0000");

    private static final DecimalFormat sixdf = new DecimalFormat("000000");

    public static String getFourdf() {
        return fourdf.format(random.nextInt(10000));
    }

    public static String getSixdf() {
        return sixdf.format(random.nextInt(100000));
    }

    *//*
     * 给定数组，抽取n个数据
     *
     * @param list
     * @param n
     * @return
     *//*
    public static ArrayList getRandom(List list, int n) {
        Random random = new Random();
        HashMap<Object, Object> hashMap = new HashMap<Object, Object>();

        //生成随机数，并且存入HashMap
        for (int i = 0; i < list.size(); i++) {
            int number = random.nextInt(100) + 1;
            hashMap.put(number, i);
        }

        //从HashMap导入数组
        Object[] robjs = hashMap.values().toArray();
        ArrayList arrayList = new ArrayList();

        //遍历数组并打印数据
        for (int i = 0; i < n; i++) {
            arrayList.add(list.get((int) robjs[i]));
            System.out.println(list.get((int) robjs[i]) + "\t");
        }
        System.out.println("\t");
        return arrayList;
    }*/
}
